
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title> 方剂 </title>
  <link rel="stylesheet" type="text/css" href="/css/style.css" />

  <style type="text/css">
    *, body {
      margin: 0px;
      font-family: '微软雅黑';
    }
  </style>
  <script src="~/js/jquery-1.10.2.min.js"></script>
  <script src="~/js/generic.js"></script>
  <script src="~/js/fypage.js"></script>
</head>

<body>
@Html.Partial("top")

<table class="maintable"style="width:100%">
  <tr>
    @Html.Partial("menu")
    <td class="rightmaintd" valign="top">
      <div style="height:40px;text-align:center;background-color:#009966">
        <p style="font-weight:bold;padding-top:10px;font-size:larger;color:white">方剂库</p>
      </div>
      <div class="searchdiv">
        <input type="submit" id="btnAdd" style="display: none;" value="+添加方剂" class="denglubtn" onclick="create()">
        <input type="button" value="+批量添加" class="denglubtn" onclick="BatchAdd();">
        <span id="nianjispan" style="display:none">年级</span><select id="nianji" onchange="getList();" style="display:none">
        <option value="全部">全部</option>
        <option value="2013级">2013级</option>
        <option value="2014级">2014级</option>
        <option value="2015级">2015级</option>
        <option value="2016级">2016级</option>
        <option value="2017级">2017级</option>
        <option value="2018级">2018级</option>
        <option value="2019级">2019级</option>
        <option value="2020级">2020级</option>
        <option value="2021级">2021级</option>
        <option value="2022级">2022级</option>
        <option value="2023级">2023级</option>
        <option value="2024级">2024级</option>
        <option value="2025级">2025级</option>
        <option value="2026级">2026级</option>
        <option value="2027级">2027级</option>
        <option value="2028级">2028级</option>
        <option value="2029级">2029级</option>
        <option value="2030级">2030级</option>
      </select> &nbsp; &nbsp;
        <span id="companyspan" style="display:none">
                        班级
                    </span>
        <select id="company" onchange="getList();" style="display:none">
          <option value="全部">全部</option>
          <option value="中医学教改班">中医学教改班</option>
          <option value="中医学(1)班">中医学(1)班</option>
          <option value="中医学(2)班">中医学(2)班</option>
          <option value="中医学(3)班">中医学(3)班</option>
          <option value="中医学(4)班">中医学(4)班</option>
          <option value="中医学（5+3）班">中医学（5+3）班</option>
          <option value="中医学美康班">中医学美康班</option>
          <option value="针灸推拿学(1)班">针灸推拿学(1)班</option>
          <option value="针灸推拿学(2)班">针灸推拿学(2)班</option>
          <option value="针灸推拿学(3)班">针灸推拿学(3)班</option>
          <option value="针灸推拿学（5+3）班">针灸推拿学（5+3）班</option>
          <option value="针灸推拿学教改">针灸推拿学教改</option>
          <option value="针刀">针刀</option>
          <option value="针灸推拿学(针刀)">针灸推拿学(针刀)</option>
          <option value="骨伤(1)班">骨伤(1)班</option>
          <option value="骨伤(2)班">骨伤(2)班</option>
          <option value="骨伤(5+3)班">骨伤(5+3)班</option>
          <option value="中西医临床(全科医学)(1)班">中西医临床(全科医学)(1)班</option>
          <option value="中西医临床(全科医学)(2)班">中西医临床(全科医学)(2)班</option>
          <option value="中西医临床(全科医学)(3)班">中西医临床(全科医学)(3)班</option>
          <option value="中西医临床(全科医学)(4)班">中西医临床(全科医学)(4)班</option>
          <option value="中西医临床医(1)班">中西医临床医(1)班</option>
          <option value="中西医临床医(2)班">中西医临床医(2)班</option>
          <option value="中西医临床医(3)班">中西医临床医(3)班</option>
          <option value="中西医临床医(4)班">中西医临床医(4)班</option>
          <option value="中西医结合(5+3)班">中西医结合(5+3)班</option>
          <option value="中西医结合(教改)班">中西医结合(教改)班</option>
          <option value="七年制骨伤">七年制骨伤</option>
          <option value="七年制中西医结合">七年制中西医结合</option>
          <option value="七年制中医学">七年制中医学</option>
          <option value="针灸推拿专升本">针灸推拿专升本</option>
          <option value="针推涉外">针推涉外</option>
          <option value="中西医临床教改班">中西医临床教改班</option>
          <option value="中医学(美容康复)">中医学(美容康复)</option>
          <option value="级中医学(免费)">中医学(免费)</option>
        </select>
        <div class="rightsearchdiv">
          <!-- name -->
          <div class="rightsearchdivtext">
            <input type="text" name="jingfangming" class="nobodertext" placeholder="输入方剂名查询" id="keyword" style="width:100px; float:left">
            <input type="text" name="createuser" class="nobodertext" placeholder="输入录入人查询" id="createuser" style="width:100px;">
            <button class="searchbtn" onclick="search()" style="float:right">
              <img src="/images/fdj.png" alt="" class="searchfdj">
            </button>
          </div>
        </div>
      </div>
      <table class="neirontbiao" id="tbl_list"style="width:100%"></table>

      <div class="pagediv" id="pager">
      </div>

    </td>
  </tr>
</table>

@Html.Partial("bottom")

</body>
</html>
<script type="text/javascript">
  //新的
  var usertype = "@type";
  var submit = false;
  var _old_nianji = '@ViewBag.NainJi';
  var _old_company = '@ViewBag.Company';
  var _old_currPage = '@ViewBag.CurrPage'
  var pager;
  $(document).ready(function () {
    if (_old_nianji != "" && _old_nianji != null)
      $("#nianji").val(_old_nianji);
    if (_old_company != "" && _old_company != null)
      $("#company").val(_old_company);
    if (usertype != "输入者" && usertype != "学生" && usertype != "中药+方剂录入") {
      $("#nianjispan").show()
      $("#nianji").show()
      $("#companyspan").show()
      $("#company").show()
    }
    pager = new Fypager("pager", getList);
    if (_old_currPage != "" && _old_currPage != null)
      pager.currPage = _old_currPage;
    getList();
  });

  function create() {
    location.href = "/fjgl/edit";
  }
  function BatchAdd() {
    location.href = "/fjgl/batchAdd";
  }

  function update(userid) {
    var nianji = $("#nianji").val();
    var company = $("#company").val();
    var currPage = pager.currPage;
    location.href = "/fjgl/edit?id=" + userid + "&nianji=" + nianji + "&company=" + company + "&currPage=" + currPage;
  }

  function del(userid) {
    if (confirm("确认删除方剂信息吗")) {
      util.post("/fjgl/delete", { "id": userid }, function(json) {
        if (json.status == 0) {
          getList();
        } else {
          alert(json.msg);
        }
      });
    }
  }

  function search() {
    //pager.goPage(1);
    //location.href = "/fjgl/search?jingfangming=" + encodeURI(util.FormateNull($("#keyword").val()));
    getList();
  }

  function getList() {
    var url = "/fjgl/GetList?pageIndex=" + pager.currPage + "&pageSize=" + pager.pageNum + "&nianji=" + $("#nianji").val() + "&company=" + $("#company").val();
    util.getJSON(url, { "jingfangming": $("#keyword").val(), "createuser": $("#createuser").val() }, function (json) {
      if (json.status == 0) {
        pager.showPager(json.totalPage, json.totalNum, json.pageCount);
        showList(json.list);
      } else {
        alert(json.msg);
      }
    });
  }

  function showList(list) {
    if (usertype != "名医专家") {
      $("#btnAdd").show();

    }
    var html = '<tr class="neirontbiaotou"><td width="13%">方剂名</td><td width="10%">来源</td><td width="10%">医家流派</td><td width="14%">功效</td><td width="14%">主治病症</td><td width="14%">主治症状</td><td width="10%">录入人</td><td width="6%">审核</td><td width="10%"></td></tr>';
    if (list.length == 0) {
      html += '<tr><td colspan="8" style="text-align:center;height:50px;">暂无方剂信息</td></tr>';
    }
    for (var i = 0; i < list.length; i++) {
      html += '<tr>';
      html += '<td title="' + list[i].jingfangming + '">' + util.formateTitle(list[i].jingfangming, 10, true) + '</td>';
      html += '<td>' + util.FormateNull(list[i].laiyuan) + '</td>';
      html += '<td>' + util.FormateNull(list[i].liupai) + '</td>';
      html += '<td title="' + list[i].gongneng + '">' + util.formateTitle(list[i].gongneng, 8, true) + '</td>';
      html += '<td title="' + list[i].zhuzhi + '">' + util.formateTitle(list[i].zhuzhi, 8, true) + '</td>';
      html += '<td title="' + list[i].zhuzhizhengzhuang + '">' + util.formateTitle(list[i].zhuzhizhengzhuang, 8, true) + '</td>';
      html += '<td>' + util.FormateNull(list[i].createuser) + '</td>';
      html += '<td>' + util.FormateNull(list[i].shenhe) + '</td>';
      if (usertype != "名医专家") {
        html += '<td>' + '<a href="javascript:update(\'' + list[i].id + '\')">编辑</a>&nbsp;<a style=";color:#0c531f" href="javascript:del(\'' + list[i].id + '\')">删除</a>' + '</td></tr>';
      } else {
        html += '<td>&nbsp;</td>';
      }
    }
    $("#tbl_list").html(html);
  }
</script>